<include file="Public:head" />
<include file="Public:header" />
<include file="Public:left" />
<section id='content'>
    <div class='container-fluid'>
        <div class='row-fluid' id='content-wrapper'>
            <div class='span12'>
                <div class='row-fluid'>
                    <div class='span12'>
                        <div class='page-header'>
                            <h1 class='pull-left'>
                                <i class='icon-ok'></i>
                                <span>修改登陆密码</span>
                            </h1>
                        </div>
                    </div>
                </div>
                <div class='row-fluid'>
                    <div class='span12 box'>
                        <div class='box-header blue-background'>
                            <div class='title'>修改密码</div>
                        </div>
                        <div class='box-content'>
                            <form class='form form-horizontal validate-form' style='margin-bottom: 0;' action="{:U('User/edit_password')}" method="post"/>
                                <div class='control-group'>
                                    <label class='control-label' for='validation_name'>登录名</label>
                                    <div class='controls'>
                                        {$admin.uname}
                                    </div>
                                </div>
                                <div class='control-group'>
                                    <label class='control-label' for='validation_select'>用户组别</label>
                                    <div class='controls'>
                                        <switch name="admin.group" >
                                            <case value="1">总管理员</case>
                                            <case value="2">公司员工</case>
                                            <default />经销商
                                        </switch>
                                    </div>
                                </div>
                                <div class='control-group'>
                                    <label class='control-label' for='validation_password'>原先密码</label>
                                    <div class='controls'>
                                        <input  name='pwd1' id="pwd1" placeholder='旧密码' type='password' onblur="check_password(this.id);"/>
                                        <div class="text-success icon-ok align-right hidden" id="right_pwd"></div>
                                    </div>
                                </div>
                                <div class='control-group'>
                                    <label class='control-label' for='validation_password_confirmation'>新密码</label>
                                    <div class='controls'>
                                        <input name='pwd2' placeholder='新密码' type='password' />
                                    </div>
                                </div>
                                
                                <div class='form-actions' style='margin-bottom:0'>
                                    <button class='btn btn-primary' type='submit'>
                                        <i class='icon-save'></i>
                                        修改
                                    </button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
    </div>
</section>
</div>
<include file="Public:bottom" />
<script type="text/javascript">
    function check_password(x){
        var y=document.getElementById(x).value
        $.post("__URL__/check_pword", { "pwd": y},
            function(data){
                if (data.status==0) {
                    alert('输入原密码错误，请重新输入！');
                    location.replace(location.href);  
                }else{
                    $("#right_pwd").removeClass('hidden');
                }
            }, "json");
    }
    $(document).ready(function () {

      $("ul[class='nav nav-stacked']").removeClass('in');
      $("#admin").addClass('in');
      $("li[class='guan']").removeClass('active');
      $("#edit_password").addClass('active');
    });
</script>